/**
 * Copyright &copy; 2012-2016 <a href="https://istep.lczyfz.com">Istep</a> All rights reserved.
 */
package com.lczyfz.istep.modules.teach.service;

import java.util.List;

import com.lczyfz.istep.common.constants.DeleteFlag;
import com.lczyfz.istep.modules.resource.entity.ResourcePaperQuestion;
import com.lczyfz.istep.modules.resource.entity.ResourceQuestionAnswer;
import com.lczyfz.istep.modules.teach.entity.TeachExam;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.lczyfz.istep.common.persistence.Page;
import com.lczyfz.istep.common.service.CrudService;
import com.lczyfz.istep.modules.teach.entity.TeachStudentPaper;
import com.lczyfz.istep.modules.teach.dao.TeachStudentPaperDao;

/**
 * 学生考试中间表Service
 * @author cqh
 * @version 2017-05-16
 */
@Service
@Transactional(readOnly = true)
public class TeachStudentPaperService extends CrudService<TeachStudentPaperDao, TeachStudentPaper> {
	@Autowired
	TeachStudentPaperDao teachStudentPaperDao ;
	@Transactional(readOnly = false)
	public void deleteStudentAnswerByuserIdandPaperId(String userId,String paperId){
		teachStudentPaperDao.deleteStudentAnswerByuserIdandPaperId(userId,paperId);
	}

	public TeachStudentPaper get(String id) {
		return super.get(id);
	}
	
	public List<TeachStudentPaper> findList(TeachStudentPaper teachStudentPaper) {
		return super.findList(teachStudentPaper);
	}
	
	public Page<TeachStudentPaper> findPage(Page<TeachStudentPaper> page, TeachStudentPaper teachStudentPaper) {
		return super.findPage(page, teachStudentPaper);
	}


	public List<TeachStudentPaper> findStuAnswerList(String id,String paperId){
		return teachStudentPaperDao.findStuAnswerList(id,paperId, DeleteFlag.deleteFlag);
	}
	
	@Transactional(readOnly = false)
	public void save(TeachStudentPaper teachStudentPaper) {
		super.save(teachStudentPaper);
	}
	
	@Transactional(readOnly = false)
	public void delete(TeachStudentPaper teachStudentPaper) {
		super.delete(teachStudentPaper);
	}

	public List<ResourcePaperQuestion> getScoreByPaperIdAndQuestionId(String paperId,String questionId){
		return teachStudentPaperDao.getScoreByPaperIdAndQuestionId(paperId, questionId, DeleteFlag.deleteFlag);
	}
	public List<ResourceQuestionAnswer> getRightAnswerByQuestionId(String questionId){
		return teachStudentPaperDao.getRightAnswerByQuestionId(questionId, DeleteFlag.deleteFlag);
	}

	public List<TeachStudentPaper> getAllScoreByUserIdAndPaperId(String userId,String paperId){
		return teachStudentPaperDao.getAllScoreByUserIdAndPaperId(userId,paperId, DeleteFlag.deleteFlag);
	}
	public List<TeachExam> getIfCheckAnswerByExamId(String examId){
		return teachStudentPaperDao.getIfCheckAnswerByExamId(examId, DeleteFlag.deleteFlag);
	}

	public List<ResourceQuestionAnswer> getQuestionAnswerList(String paperId){
		return teachStudentPaperDao.getQuestionAnswerList(paperId, DeleteFlag.deleteFlag);
	}





}